package com.idelan.commonMessage;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.Bean;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
* @Description:    java类作用描述
* @Author:         jzhou
* @CreateDate:     2018\7\18 0018 15:14
* @UpdateUser:     jzhou
* @UpdateDate:     2018\7\18 0018 15:14
* @UpdateRemark:   修改内容
* @Version:        1.0
*/
@EnableSwagger2
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
public class Application {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.idelan.commonMessage.controller"))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("德澜通用服务接口测试")
                .description("api接口的文档整理，支持在线测试")
                .contact("Vector.jzhou")
                .version("1.0")
                .build();
    }
    public static void main(String[] args) {
        new SpringApplicationBuilder(Application.class).run(args);
        System.out.println("测试启动！！！");
    }
}
